Mass on a spring

The net force acting on a mass at the end of a spring is

$$F=-k(y-y_0)$$

where $$ y_0 $$ is the equilibrium height and $$ k $$ is the spring constant.

This can also be written as

$$ y''(t)=-\frac{k}{m}(y-y_0)$$

The general solution is

$$ y(t)=A\sin(\sqrt\frac{k}{m}(t-t_0))+y_0$$

and the velocity is then

$$ y'(t)=\sqrt\frac{k}{m}A\cos(\sqrt\frac{k}{m}(t-t_0))$$